package com.xsh.gls.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092500590992";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCjFDGB4jxn+uo9XbUM3wjn1ASoqfJYrLM+GrzOW9CmdMAQUFckTvhGI6Kad53DVnnnqYh9yQH79/Tpyngg8zE56ZCWK5773slwiHU4+7p2v/mU+YyF6XLsjsSOBF90k8+BS+kg5i8pEYLaphafNfdHfKEStEiO9oDHP5C9OQAt2xGjVmI0WoRL0E4I8L7fq52+9Eu6IK60u36QGENjPrHlZD8g18dzQAf54CHQ8qMS8xN1Np3t0Hz05U9vUninRk2FiOyiTzIlxkmLaf7ujG5KZRTY9+X5Y6X+lKEe05Je7G+B9ucIqc2AKG3rzKUsQ5WvgRejN8tByZfcACNtd6MZAgMBAAECggEATZTrwIiqiCUcjrknysnIaNG6raq7+meelisOK3YOm0HrpVczPbi78FI/pxDE4wsez5EduAmKgh6CSz7hS3umrZBqEqcJ6XUhjAG/Eq7fFGNcDv1xVruqytNYut9lsgYnr7E3ZUlcokMMZ4ygMnnv+/hUgJt38VtgBGo/J2YYqbdMG2YcDkOkRYkyZFSGSrcn0+JDoq7RzOEyRr86kuTKwyanyF0IWx6lL53YDLgbG7Ya4HbD+/qR4xtHEZKqMcBRo5x+iBWqvg8PpkcXp5kcLoW1lAMnzymNt+xte3h8W/Xv9Dx0sRlUgXTwmmeT4Mqnw1kyx0m2TgWwz3Z+U9iE6QKBgQDrf9LotG5VdN4eiar9Ed0C+Mq0uUIaAOYHX/0P6XC7NmR0LM3Nr630qngFp9hOLYKBPvzRGCS0FvW3Y7C9PbeFywZOZGBQJdkKAeDvvSURCl7ZQa2fM1MHlyUxhl5Squ8YVk7ntG9QnsPUdgPeiRsBIm9j67qJptXVrMu/ehYOowKBgQCxRnUcJ6hfcEf1FqyeSiyVETFtUSbud3m1ENwMW6SRJdlK1pJNxtz5EOFa65Gnc0gWI+Kx7fiGZN1U1x3urYo4TQIh7IMVRVwhfZ+badKqlWLNRXh0xMXXyUaATCErocZ+Be6SIKGBVzlkou0qFb7mtZ+JT8PTAaNRSo1/PbMPEwKBgA32wFzIBhrPGTSaWSc0XfSFKA/bRE4ia4FYcbr1zpdrPD2fQnzFw/zT9tXvA+Zu0GQ1hewoEFUVX3CGWr594FnwlekkDonyFJKBVgMhJgeCo+kh+deMxYmXrr7nBsTEGfVJeNhIXKldIKOCc+xIGO/SSOSV37O1zswiuNobtR8dAoGAHlxKwj+ofm/kYv03IwThDcacCHTVjhG4LmJszVEEpjctN7v34ookXiOd9MxTbbI4rlIHCSIQZjPwFA+jeLUP7wSBUP4IlSQD21iAdUVyZvSerzkuoBDzMTmvcVmYdLiIHh019qDQCC7ADZQ5ufNvdmO0pveaOhEVv15dTWVrvTECgYAdmc9F0gmxj571U8vHFpHOBuTSFnBT5gbO0xH/5Iz/LjNNXLbFaTQHAi2nuTxS2VUxSuJ0dxaHhyqGI0Az9OS1egnKhhgQrFm4UHnFSTtV7+znqQhf0UvexDtRzPQ30ZISsgccd23aDjSWcVo6xgEAjPbRlkaom4yRJteEqatU1A==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArzlkdGMc24l5Cpno6/EGB3USar4ENYx/3s2XbEmEIqdqcmVcbLCYb7C0xh0m8MjiDCq8kdqjkhnZfVVwpLvevlFBdgbqeGORNSsK2xZRSZR01KKF7aT6UAbV7urzw5Fkbl3rxAhTCUc5H7c1Fe9ekZ6UxtWt3nmyBABmPPLQoKJiLceVX3iID2yR0NzgMyYmooBQYM62tpU6mjDvK1TBAQwqU5YTWFFguaCtsPhk9I1eQbRpb/R/DedYi9jSoS01+TlsxJOBz77xOy4JuB3DGU/lh4a5Ez9z8obmk6+1gzUZc04bxf7likaZb0nbbl0+F5olrG6AP64BWPOXRt6FbwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8081/OrderController/successPay";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8081/OrderController/successPay";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

